import Vue from 'vue'
import Router from 'vue-router'

// 页面声明
import loginMain from '@/components/home/loginMain'
import homeMain from '@/components/home/homeMain'
import homeRegister from '@/components/home/homeRegister'
import homeLogin from '@/components/home/homeLogin'
import shoppingMain from '@/components/shopping/shoppingMain'
// import shoppingList from '@/components/shopping/shoppingList'
import shoppingDetails from '@/components/shopping/shoppingDetails'
import shoppingPurchase from '@/components/shopping/shoppingPurchase'
import orderMain from '@/components/order/orderMain'
import orderList from '@/components/order/orderList'
import userMain from '@/components/userCenter/userMain'
import userList from '@/components/userCenter/userList'
import userRecord from '@/components/userCenter/userRecord'
import userWithdrawals from '@/components/userCenter/userWithdrawals'
import userSubmit from '@/components/userCenter/userSubmit'
import userBankCard from '@/components/userCenter/userBankCard'
import userAddCard from '@/components/userCenter/userAddCard'
import userAddress from '@/components/userCenter/userAddress'
import userNewAddress from '@/components/userCenter/userNewAddress'
import homeDistributeProduct from '@/components/home/homeDistributeProduct'
// import homeDistributor from '@/components/home/homeDistributor'
import homePerformance from '@/components/home/homePerformance'
import homeOrder from '@/components/home/homeOrder'
import homeRegisterStepTwo from '@/components/home/homeRegisterStepTwo'
import userCommission from '@/components/userCenter/userCommission'
import userAreaOrder from '@/components/userCenter/userAreaOrder'
import userDisOrder from '@/components/userCenter/userDisOrder'
import userDistributor from '@/components/userCenter/userDistributor'
import userCode from '@/components/userCenter/userCode'
import shoppingPurchaseMenu from '@/components/shopping/shoppingPurchaseMenu'
import userChangePsWord from '@/components/userCenter/userChangePsWord'
import homeForgetPs from '@/components/home/homeForgetPs'
import userAboutUs from '@/components/userCenter/userAboutUs'
import userTotal from '@/components/userCenter/userTotal'
import userPersonData from '@/components/userCenter/userPersonData'
import userWriteData from '@/components/userCenter/userWriteData'
import userFenxiao from '@/components/userCenter/userFenxiao'

Vue.use(Router)

// 路由挂载
const loginRoute = [ // 登陆路由
  { path: '', component: homeLogin },
  { path: 'login', component: homeLogin },
  { path: 'register/:id', component: homeRegister },
  { path: 'register', component: homeRegister },
  { path: 'forgetPs', component: homeForgetPs }
]

const homeRoute = [ // 主页路由
  { path: '', component: homeDistributeProduct },
  { path: 'distributeProduct', component: homeDistributeProduct },
  // { path: 'distributor', component: homeDistributor },
  { path: 'performance', component: homePerformance },
  { path: 'homeOrder', component: homeOrder },
  { path: 'registerStepTwo', component: homeRegisterStepTwo }
]

const shoppingRoute = [ // 商城路由
  { path: '', component: shoppingDetails },
  // { path: 'details', component: shoppingDetails },
  { path: 'purchase', component: shoppingPurchase },
  { path: 'purchaseMenu', component: shoppingPurchaseMenu }
]

const orderRoute = [ // 订单路由
  { path: '', component: orderList }
]

const userRoute = [ // 用户路由
  { path: '', component: userList },
  { path: 'record', component: userRecord },
  { path: 'withdrawals', component: userWithdrawals },
  { path: 'submit', component: userSubmit },
  { path: 'bankcard', component: userBankCard },
  { path: 'addcard', component: userAddCard },
  { path: 'address', component: userAddress },
  { path: 'newaddress', component: userNewAddress },
  { path: 'commission', component: userCommission },
  { path: 'areaOrder', component: userAreaOrder },
  { path: 'disOrder', component: userDisOrder },
  { path: 'distributor', component: userDistributor },
  { path: 'code', component: userCode },
  { path: 'changePsWord', component: userChangePsWord },
  { path: 'aboutUs', component: userAboutUs },
  { path: 'total', component: userTotal },
  { path: 'personData', component: userPersonData },
  { path: 'writeData', component: userWriteData },
  { path: 'fenxiao', component: userFenxiao }
]

// 总路由
export default new Router({
  routes: [
    { path: '/', component: loginMain, children: loginRoute },
    { path: '/home', component: homeMain, children: homeRoute },
    { path: '/shopping', component: shoppingMain, children: shoppingRoute },
    { path: '/order', component: orderMain, children: orderRoute },
    { path: '/user', component: userMain, children: userRoute }
  ]
})
